import 'package:get/get.dart';
import 'package:shudu/utils/share_preference.dart';

class SetViewModel extends GetxController {
  final isMusicPlay = true.obs;
  final isVibrate = true.obs;

  @override
  void onInit() {
    super.onInit();
    _loadConfig();
  }

  void _loadConfig() {
    isVibrate.value = SharePreference.getVibrate();
    isMusicPlay.value = SharePreference.getMusic();
  }

  void configMusic(bool isPlay) {
    isMusicPlay.value = isPlay;
    SharePreference.setMusic(isPlay);
  }

  void configVibrate(bool isVibrate) {
    this.isVibrate.value = isVibrate;
    SharePreference.setVibrate(isVibrate);
  }
}
